/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package datas;

import beans.Order;
import java.sql.CallableStatement;
import java.sql.SQLException;

/**
 *
 * @author havn
 */
public class OrderObj {
    private connector con;
    //private List<Product> products;

    public OrderObj() {
        con = new connector();
        //products = listProduct();
    }

    public boolean InsertOrder(Order o) {
        try {
            CallableStatement call = con.getCon().prepareCall("{call InsertOrder(?,?,?,?)}");
            call.setString(1, o.getOrderCode());
            call.setInt(2, o.getUserid());
            call.setString(3, o.getAccBank());
            call.setInt(4, o.getTotalCost());
            if (call.executeUpdate() > 0) {
                return true;
            } else {
                return false;
            }
        } catch (SQLException ex) {
            ex.getStackTrace();
        }
        return false;
    }
}
